//package me.zhengjie.modules.wrap;
//
//
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpServletResponseWrapper;
//import java.io.ByteArrayOutputStream;
//import java.io.IOException;
//import java.io.PrintWriter;
//import java.io.UnsupportedEncodingException;
//import java.nio.charset.StandardCharsets;
//
//public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper {
//
//    private class ResponsePrintWriter extends PrintWriter {
//        ByteArrayOutputStream output;
//
//        public ResponsePrintWriter(ByteArrayOutputStream output) {
//            super(output);
//            this.output = output;
//        }
//
//        public ByteArrayOutputStream getByteArrayOutputStream() {
//            return output;
//        }
//    }
//
//    private ResponsePrintWriter writer;
//    private ByteArrayOutputStream output;
//
//    public CustomHttpServletResponseWrapper(HttpServletResponse httpServletResponse) {
//        super(httpServletResponse);
//        output = new ByteArrayOutputStream();
//        writer = new ResponsePrintWriter(output);
//    }
//
//    public String getContent() {
//        try {
//            writer.flush();
//            return writer.getByteArrayOutputStream().toString("UTF-8");
//        } catch (UnsupportedEncodingException e) {
//            return "UnsupportedEncoding";
//        }
//    }
//
//    public void close() throws IOException {
//        writer.close();
//
//        output.close();
//    }
//
//    public PrintWriter getWriter() throws IOException {
//        return writer;
//    }
//
//}
